package easy;

public class Solution_1758 {

    public int minOperations(String s) {
        int count_1 = 0, count_2 = 0;
        int pre_1 = 0, pre_2 = 1;
        for (int i = 0; i < s.length(); i++) {
            int temp = s.charAt(i) - '0';
            count_1 += pre_1 ^ temp;
            pre_1 ^= 1;

            count_2 += pre_2 ^ temp;
            pre_2 ^= 1;
        }
        return Math.min(count_1, count_2);
    }

    public static void main(String[] args) {
        Solution_1758 model = new Solution_1758();
        System.out.println(model.minOperations("0100"));
        System.out.println(model.minOperations("10"));
        System.out.println(model.minOperations("1111"));
    }
}
